﻿using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using PortaCapena.OdooJsonRpcClient.Attributes;
using PortaCapena.OdooJsonRpcClient.Converters;
using PortaCapena.OdooJsonRpcClient.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Text;

namespace OdooRpcClient.Model.Base
{
    [OdooTableName("res.country")]
    [JsonConverter(typeof(OdooModelConverter))]
    public class ResCountryOdooModel : IOdooModel
    {

        /// <summary>
        /// Name
        /// Char
        /// The full name of the country.
        /// required
        /// <summary>
        [JsonProperty("name")]
        [Description("Name")]
        public string Name { get; set; }

        /// <summary>
        /// Code
        /// Char
        /// The ISO country code in two chars. 
        ///     You can use this field for quick search.
        /// <summary>
        [JsonProperty("code")]
        [Description("Code")]
        public string Code { get; set; }

        /// <summary>
        /// AddressFormat
        /// Text
        /// Display format to use for addresses belonging to this country.
        ///     You can use python-style string pattern with all the fields of the address(for example, use '%(street)s' to display the field 'street') plus
        ///     %(state_name) s: the name of the state
        ///     %(state_code) s: the code of the state
        ///     %(country_name) s: the name of the country
        ///     %(country_code) s: the code of the country
        /// <summary>
        [JsonProperty("address_format")]
        [Description("AddressFormat")]
        public string AddressFormat { get; set; }

        /// <summary>
        /// AddressViewId
        /// Many2one
        /// Use this field if you want to replace the usual way to encode a complete address. Note that the address_format field is used to modify the way to display addresses (in reports for example), while this field is used to modify the input form for addresses.
        /// ir.ui.view
        /// <summary>
        [JsonProperty("address_view_id")]
        [Description("AddressViewId")]
        public long? AddressViewId { get; set; }

        /// <summary>
        /// CurrencyId
        /// Many2one
        /// res.currency
        /// <summary>
        [JsonProperty("currency_id")]
        [Description("CurrencyId")]
        public long? CurrencyId { get; set; }

        /// <summary>
        /// ImageUrl
        /// Char
        /// Url of static flag image
        /// <summary>
        [JsonProperty("image_url")]
        [Description("ImageUrl")]
        public string ImageUrl { get; set; }

        /// <summary>
        /// PhoneCode
        /// Integer
        /// <summary>
        [JsonProperty("phone_code")]
        [Description("PhoneCode")]
        public int? PhoneCode { get; set; }

        /// <summary>
        /// CountryGroupIds
        /// Many2many
        /// res.country.group
        /// <summary>
        [JsonProperty("country_group_ids")]
        [Description("CountryGroupIds")]
        public long[] CountryGroupIds { get; set; }

        /// <summary>
        /// StateIds
        /// One2many
        /// res.country.state
        /// country_id
        /// <summary>
        [JsonProperty("state_ids")]
        [Description("StateIds")]
        public long[] StateIds { get; set; }

        /// <summary>
        /// NamePosition
        /// Selection
        /// Determines where the customer/company name should be placed, i.e. after or before the address.
        /// <summary>
        [JsonProperty("name_position")]
        [Description("NamePosition")]
        public CustomerNamePositionResCountryOdooEnum? NamePosition { get; set; }

        /// <summary>
        /// VatLabel
        /// Char
        /// Use this field if you want to change vat label.
        /// <summary>
        [JsonProperty("vat_label")]
        [Description("VatLabel")]
        public string VatLabel { get; set; }

        /// <summary>
        /// StateRequired
        /// Boolean
        /// <summary>
        [JsonProperty("state_required")]
        [Description("StateRequired")]
        public bool? StateRequired { get; set; }

        /// <summary>
        /// ZipRequired
        /// Boolean
        /// <summary>
        [JsonProperty("zip_required")]
        [Description("ZipRequired")]
        public bool? ZipRequired { get; set; }

        /// <summary>
        /// Id
        /// Integer
        /// <summary>
        [JsonProperty("id")]
        [Description("Id")]
        public long Id { get; set; }

        /// <summary>
        /// DisplayName
        /// Char
        /// <summary>
        [JsonProperty("display_name")]
        [Description("DisplayName")]
        public string DisplayName { get; set; }

        /// <summary>
        /// CreateUid
        /// Many2one
        /// res.users
        /// <summary>
        [JsonProperty("create_uid")]
        [Description("CreateUid")]
        public long? CreateUid { get; set; }

        /// <summary>
        /// CreateDate
        /// Datetime
        /// <summary>
        [JsonProperty("create_date")]
        [Description("CreateDate")]
        public DateTime? CreateDate { get; set; }

        /// <summary>
        /// WriteUid
        /// Many2one
        /// res.users
        /// <summary>
        [JsonProperty("write_uid")]
        [Description("WriteUid")]
        public long? WriteUid { get; set; }

        /// <summary>
        /// WriteDate
        /// Datetime
        /// <summary>
        [JsonProperty("write_date")]
        [Description("WriteDate")]
        public DateTime? WriteDate { get; set; }

        /// <summary>
        /// LastUpdate
        /// Datetime
        /// <summary>
        [JsonProperty("__last_update")]
        [Description("LastUpdate")]
        public DateTime? LastUpdate { get; set; }
    }


    // Determines where the customer/company name should be placed, i.e. after or before the address.
    [JsonConverter(typeof(StringEnumConverter))]
    public enum CustomerNamePositionResCountryOdooEnum
    {
        [EnumMember(Value = "before")]
        BeforeAddress = 1,

        [EnumMember(Value = "after")]
        AfterAddress = 2,
    }

}
